package com.redteam.data.beans;

import com.redteam.data.abstracts.Employee;
import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

/**
 * A java bean for Maintenance Engineer
 * @author Jeremy Reed
 * @author Teddy Karam
 */
public final class MaintenanceEngineer extends Employee implements Serializable {

    private List<MaintenanceMemo> assignedMemo;
    private static final long serialVersionUID = 1L;


    /**
     * Full MaintenanceEngineer constructor
     * @param id
     * @param firstName
     * @param middleName
     * @param lastName
     * @param street
     * @param city
     * @param state
     * @param zipCode
     * @param email
     * @param fBOId
     * @param birthdate
     * @param homePhone
     * @param cellPhone
     * @param workPhone
     * @param gender
     * @param type
     * @param userName
     * @param password
     */
    public MaintenanceEngineer(long id, String firstName, String middleName, String lastName, String street, String city, String state, String zipCode,
            String email, long fBOId, Date birthdate, String homePhone, String cellPhone, String workPhone, String gender, String type, String userName, String password) {
        super(id, firstName, middleName, lastName, street, city, state, zipCode, email, fBOId, birthdate, homePhone, cellPhone, workPhone, gender, type, userName, password);


        assignedMemo = new ArrayList<MaintenanceMemo>();
    }

    /**
     * Default constructor for bean
     */
    public MaintenanceEngineer() {
        super();
        assignedMemo = new ArrayList<MaintenanceMemo>();
    }

    /**
     * Returns the list of assigned memos
     * @return assignedMemo
     */
    public List<MaintenanceMemo> getAssignedMemo() {
        return assignedMemo;


    }

    /**
     * Sets the assigned memo list
     * @param assignedMemo the assignedMemo to set
     */
    public void setAssignedMemo(List<MaintenanceMemo> assignedMemo) {
        this.assignedMemo = assignedMemo;


    }

    /**
     * Add assigned memo to the memo list
     * @param assignedMemo
     */
    public void addAssignedMemo(MaintenanceMemo assignedMemo) {
        this.assignedMemo.add(assignedMemo);


    }

    /**
     * @inheritDoc
     */
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MaintenanceEngineer other = (MaintenanceEngineer) obj;
        if (this.assignedMemo != other.assignedMemo && (this.assignedMemo == null || !this.assignedMemo.equals(other.assignedMemo))) {
            return false;
        }
        return true;
    }

    /**
     * @inheritDoc
     */
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 89 * hash + (this.assignedMemo != null ? this.assignedMemo.hashCode() : 0);
        return hash;
    }
}
